package com.item.yxlottery.yxlottery.adapter;

/*
 *------------------------------
 * @创建者      Administrator
 * @创建时间    2017/1/5 10:12
 * @文件描述    彩店评论了列表adapter
 *------------------------------
 */

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.item.yxlottery.yxlottery.R;
import com.item.yxlottery.yxlottery.bean.StoreCommentBean;
import com.item.yxlottery.yxlottery.views.SimpleRatingBar;

import java.util.List;

import jp.wasabeef.glide.transformations.CropCircleTransformation;

public class StoreCommentsAdapter extends BaseQuickAdapter<StoreCommentBean, BaseViewHolder> {
    private Context mContext;

    public StoreCommentsAdapter(Context context, int layoutResId, List<StoreCommentBean> data) {
        super(layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, StoreCommentBean item) {
        Glide.with(mContext).load(item.getIconUrl()).bitmapTransform(new CropCircleTransformation(mContext))
                .into(((ImageView) helper.getView(R.id.iv_item_comment_icon)));
        helper.setText(R.id.tv_item_comment_name, item.getName()).setText(R.id.tv_item_comment_time, item.getTime())
                .setText(R.id.tv_item_comment_comment, item.getComment());
        ((SimpleRatingBar) helper.getView(R.id.srb_item_comment_star)).setRating(Float.parseFloat(item.getStar()));
    }
}
